package com.atguigu.tingshu.account.service;

import com.atguigu.tingshu.model.account.UserAccount;
import com.atguigu.tingshu.model.account.UserAccountDetail;
import com.atguigu.tingshu.vo.account.AccountLockVo;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;

import java.math.BigDecimal;

public interface UserAccountService extends IService<UserAccount> {

    /**
     * 添加账户信息
     * @param userId
     */
    void addUserAccount(Long userId);

    /**
     * 获取账户可用余额
     * @return
     */
    BigDecimal getAvailableAmount(Long userId);

    /**
     * 账户可用余额检查及锁定
     * @param accountLockVo
     */
    int checkAndLock(AccountLockVo accountLockVo);

    /**
     * 充值
     * @param userId
     * @param amount
     * @param orderNo
     * @param tradeType
     * @param title
     */
    void add(Long userId, BigDecimal amount, String orderNo, String tradeType, String title);

    /**
     * 获取用户充值记录
     * @param pageParam
     * @param userId
     * @return
     */
    IPage<UserAccountDetail> findUserRechargePage(IPage<UserAccountDetail> pageParam, Long userId);

    /**
     * 获取用户消费记录
     * @param pageParam
     * @param userId
     * @return
     */
    IPage<UserAccountDetail> findUserConsumePage(IPage<UserAccountDetail> pageParam, Long userId);
}
